<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/6/25 10:33
 * Modified Time: 2019/6/25 10:33
 * Version: 2.0
 */

namespace App\Modules\Store\Validators;


use Flower\Core\Repository\Contracts\ValidatorInterface;
use Flower\Core\Repository\Validator\LaravelValidator;

class StoreValidator extends LaravelValidator
{
    protected $rules = [
        ValidatorInterface::RULE_CREATE => [
            'name' => 'required|between:1,10',
//            'phone' => array('required','regex:/^1[345678]{1}\d{9}$/'),
//            'wechat' => 'between:0,20',
            'profile' => 'between:0,255',
//            'uid' => 'required',
            'adcode' => 'required|numeric',
            'longitude' => 'required|numeric',
            'latitude' => 'required|numeric',
            'address' => 'required|between:3,100',
//            'doorplate' => 'between:0,100',
        ],
        ValidatorInterface::RULE_UPDATE => [
//            'phone' => array('filled','regex:/^1[345678]{1}\d{9}$/'),
//            'wechat' => 'filled|between:0,20',
            'profile' => 'between:0,255',
//            'uid' => 'filled',
            'adcode' => 'filled',
            'longitude' => 'filled',
            'latitude' => 'filled',
            'address' => 'filled|between:3,100',
//            'doorplate' => 'filled|between:0,100',
        ]
    ];

    protected $messages = [
        'name.required' => '店铺名不能为空',
        'name.between' => '店铺名请输入1-10个字符',

//        'phone.required' => '手机号码不能为空',
//        'phone.regex' => '手机号码格式错误',

//        'wechat.between' => '微信号码格式错误',

        'profile.between' => '店铺简介字数不能多于255个',


        'adcode.required' => '请选择地址',
        'adcode.numeric' => 'adcode格式错误',

        'longitude.required' => '请选择地址',
        'longitude.numeric' => 'longitude格式错误',

        'latitude.required' => '请选择地址',
        'latitude.numeric' => 'latitude格式错误',

        'open_time.required' => '开店时间不能为空',
        'close_time.required' => '关店时间不能为空',

        'address.required' => '请填写地址',
        'address.filled' => '请填写地址',
    ];
}